package bp.zoufeng.com.bp;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;

public class MyActivity extends AppCompatActivity {

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = getWindow();
        //取消设置透明状态栏,使 ContentView 内容不再覆盖状态栏
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        //需要设置这个 flag 才能调用 setStatusBarColor 来设置状态栏颜色
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        //设置状态栏颜色
        window.setStatusBarColor(Color.parseColor("#8b0f1e"));

        setContentView(R.layout.mypage);

        int sum = 12285;
        int today = 1432;
        int out = 1056;

        String strsum = getIntent().getStringExtra("sum");
        String strtoday = getIntent().getStringExtra("today");
        String strout = getIntent().getStringExtra("out");
        if(!TextUtils.isEmpty(strsum)){
            sum = Integer.parseInt(strsum);
        }if(!TextUtils.isEmpty(strtoday)){
            today = Integer.parseInt(strtoday);
        }if(!TextUtils.isEmpty(strout)){
            out = Integer.parseInt(strout);
        }

        ((TextView) findViewById(R.id.tv_sum)).setText(sum+"");
        ((TextView) findViewById(R.id.tv_today)).setText(today+"");
        ((TextView) findViewById(R.id.tv_out)).setText(out+"");

    }
}
